<extend name="Common@Base/layout"/>
<block name="body">
    <div class="home-main">
        <div class="container-fluid">
            <div class="row">
                <!--<div class="col-sm-3">-->
                <!--<include file="Home/Public/directorpanel"/>-->
                <!--</div>-->
                <div class="col-sm-6">
                    <div class="panel panel-default panel-home-table">
                        <div class="panel-body">
                            <h5 class="home-title col-sm-6">通知公告</h5>
                            <span class="pull-right"><a href="/notice/index/index" class="margin-right-10">更多</a></span>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover table-end mtable">
                                <thead>
                                <tr>
                                    <th class="text-center" style="width:10px">序号</th>
                                    <th>标题</th>
                                    <th class="text-center" style="width:16px">状态</th>
                                    <th class="text-right" style="width:30px">发布时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $i=0; ?>
                                <volist name="notice_list" id="notice">
                                    <tr>
                                        <td class="text-center">{$i}</td>
                                        <td>
                                            <div class="truncate-s" title="{$notice.title}">
                                                <a target="_blank" href="/notice/index/detail?id={$notice.id}">{$notice.title}</a>
                                            </div>
                                        </td>
                                        <if condition="$notice['status']==0">
                                            <td class="text-center" style="color: red">{$notice.status|fc_get_config_value="DOC_READ_STATUS"}</td>
                                            <else/>
                                            <td class="text-center">{$notice.status|fc_get_config_value="DOC_READ_STATUS"}</td>
                                        </if>
                                        <td class="text-right">{$notice.create_at|fc_get_date}</td>
                                    </tr>
                                </volist>

                                <?php for ($in=$i; $in<6; $in++){ ?>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td></td>
                                    <td class="text-right"></td>
                                    <td class="text-right"></td>
                                </tr>
                                <?php }?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <if condition="$Think.session.user_auth.role eq 3">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待办任务</h5>
                                <span class="pull-right"><a href="/task/index/index?task_type=0" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">状态</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list1" id="task1">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task1.title}">
                                                    <a target="_blank" href="/task/index/edit?id={$task1.id}">{$task1.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task1.status|fc_get_config_value="DOC_STATUS"}</td>
                                            <td class="text-right">{$task1.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>

                <if condition="$Think.session.user_auth.role eq 2">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待评任务</h5>
                                <span class="pull-right"><a href="/task/score/index?task_type=0" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">总数</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list1" id="task1">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task1.title}">
                                                    <a target="_blank" href="/task/score/detail?taskid={$task1.id}&search_status=2">{$task1.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task1.all_user_task|count}</td>
                                            <td class="text-right">{$task1.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>

                <if condition="$Think.session.user_auth.role eq 1">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待审任务</h5>
                                <span class="pull-right"><a href="/task/review/index?task_type=0" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">总数</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list1" id="task1">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task1.title}">
                                                    <a target="_blank" href="/task/review/detail?taskid={$task1.id}&search_status=3">{$task1.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task1.all_user_task|count}</td>
                                            <td class="text-right">{$task1.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>

                <div class="col-sm-6">
                    <div class="panel panel-default panel-home-table">
                        <div class="panel-body">
                            <h5 class="home-title col-sm-6">文件下载</h5>
                            <span class="pull-right"><a href="/file/index/index" class="margin-right-10">更多</a></span>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover table-end">
                                <thead>
                                <tr>
                                    <th class="text-center" style="width:10px">序号</th>
                                    <th>文件名</th>
                                    <th class="text-center" style="width:16px">
                                    <th class="text-right" style="width:30px">发布时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td class="text-center">1</td>
                                    <td>
                                        <div class="truncate-s" title="">
                                            厦门市文明单位测评体系操作手册2017版（最终稿）.xls
                                        </div>
                                    </td>
                                    <td class="text-center">
                                        <a target="_blank" href="http://xmwmb.oss-cn-shenzhen.aliyuncs.com/xmwmb/B4ymX6QHPG.xls">下载</a>
                                    </td>
                                    <td class="text-right">2018-06-01</td>
                                </tr>
                                <tr>
                                    <td class="text-center">2</td>
                                    <td>
                                        <div class="truncate-s" title="">
                                            关于印发湖里区文明单位、文明社区、文明校园测评体系的通知.doc
                                        </div>
                                    </td>
                                    <td class="text-center">
                                        <a target="_blank" href="http://xmwmb.oss-cn-shenzhen.aliyuncs.com/xmwmb/7kAraxPfcY.doc">下载</a>
                                    </td>
                                    <td class="text-right">2018-06-01</td>
                                </tr>
                                <tr>
                                    <td class="text-center">3</td>
                                    <td>
                                        <div class="truncate-s" title="">
                                            福建省文明单位测评体系操作手册2017版.xls
                                        </div>
                                    </td>
                                    <td class="text-center">
                                        <a target="_blank" href="http://xmwmb.oss-cn-shenzhen.aliyuncs.com/xmwmb/xDb8czP8Z7.xls">下载</a>
                                    </td>
                                    <td class="text-right">2018-06-01</td>
                                </tr>
                                <tr>
                                    <td class="text-center">4</td>
                                    <td>
                                        <div class="truncate-s" title="">
                                            公益广告下载.rar
                                        </div>
                                    </td>
                                    <td class="text-center">
                                        <a target="_blank" href="http://xmwmb.oss-cn-shenzhen.aliyuncs.com/xmwmb/SZ8arPy5tB.rar">下载</a>
                                    </td>
                                    <td class="text-right">2018-06-01</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td></td>
                                    <td class="text-right"></td>
                                    <td class="text-right"></td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td></td>
                                    <td class="text-right"></td>
                                    <td class="text-right"></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <if condition="$Think.session.user_auth.role eq 3">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待办加分项</h5>
                                <span class="pull-right"><a href="/task/index/index?task_type=1" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">状态</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list2" id="task2">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task2.title}">
                                                    <a target="_blank" href="/task/index/edit?id={$task2.id}">{$task2.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task2.status|fc_get_config_value="DOC_STATUS"}</td>
                                            <td class="text-right">{$task2.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>

                <if condition="$Think.session.user_auth.role eq 2">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待评加分项</h5>
                                <span class="pull-right"><a href="/task/score/index?task_type=1" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">总数</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list2" id="task2">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task2.title}">
                                                    <a target="_blank" href="/task/score/detail?taskid={$task1.id}&search_status=2">{$task2.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task2.all_user_task|count}</td>
                                            <td class="text-right">{$task2.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>

                <if condition="$Think.session.user_auth.role eq 1">
                    <div class="col-sm-6">
                        <div class="panel panel-default panel-home-table">
                            <div class="panel-body">
                                <h5 class="home-title col-sm-6">待审加分项</h5>
                                <span class="pull-right"><a href="/task/review/index?task_type=1" class="margin-right-10">更多</a></span>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover table-end">
                                    <thead>
                                    <tr>
                                        <th class="text-center" style="width:10px">序号</th>
                                        <th>标题</th>
                                        <th class="text-center" style="width:16px">总数</th>
                                        <th class="text-right" style="width:30px">发布时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $i=0; ?>
                                    <volist name="task_list2" id="task2">
                                        <tr>
                                            <td class="text-center">{$i}</td>
                                            <td>
                                                <div class="truncate-s" title="{$task2.title}">
                                                    <a target="_blank" href="/task/review/detail?taskid={$task1.id}&search_status=3">{$task2.title}</a>
                                                </div>
                                            </td>
                                            <td class="text-right">{$task2.all_user_task|count}</td>
                                            <td class="text-right">{$task2.create_at|fc_get_date}</td>
                                        </tr>
                                    </volist>
                                    <?php for ($in=$i; $in<6; $in++){ ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td></td>
                                        <td class="text-right"></td>
                                        <td class="text-right"></td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </if>
            </div>

        </div>
    </div>
    <script src="__PUBLIC__/Common/js/jquery.imagescroll.js"></script>
    <script>
        var allOrgTree = eval('{$org_json}');
        var tr_temp = $('<tr></tr>');
        var $tr = $(tr_temp);
        var td_temp = $('<td  class="text-right"></td>');
        var $td = $(td_temp);
        $(document).ready(function () {
            $('#nav-home').addClass("active");
            $('#org_depart_tree').delegate('.item-folder', 'click', function (e) {
                var $this = $(this);
                var nodeid = $this.find('.name').data('id');
                var wrapper = $('#sum_table_tb');
                wrapper.children().remove();
                var root = null;
                for (var index in allOrgTree) {
                    var tnode = allOrgTree[index];
                    root = searchNode(tnode, nodeid);
                    if (root != null) {
                        addRow(root, wrapper, 1);
                        break;
                    }
                }
            });

        })

        function searchNode(node, nodeid) {
            if (node['id'] == nodeid) {
                return node;
            } else {
                if (node['_child'] != null) {
                    for (var index in node['_child']) {
                        var child = node['_child'][index];
                        var r = searchNode(child, nodeid);
                        if (r != null) {
                            return r;
                        }
                    }
                }
            }
            return null;
        }

        function addRow(node, wrapper, i) {
            var level_class_name1 = 'level' + i;
            if (node != null) {
                var titletr = $tr.clone().addClass('td-title');

                titletr.append($td.clone().removeClass('text-right').addClass(level_class_name1).text(node.name));
                wrapper.append(titletr);

                var arr = new Array();
                arr[0] = 0;
                arr[1] = 0;
                arr[2] = 0;
                arr[3] = 0;
                if (node['sys_user'] != null) {
                    var level_class_name2 = 'level' + (i + 1);
                    for (var index in node['sys_user']) {
                        var leaf = node['sys_user'][index];
                        if (leaf.role < 3) {
                            var ctr = $tr.clone();
                            ctr.append($td.clone().removeClass('text-right').addClass(level_class_name2).text(leaf.name));
                            ctr.append($td.clone().text(leaf.phone_count));
                            ctr.append($td.clone().text(leaf.follow_count));
                            ctr.append($td.clone().text(leaf.signed_count));
                            ctr.append($td.clone().text(leaf.add_count));
                            wrapper.append(ctr);
                            arr[0] += parseInt(leaf.phone_count);
                            arr[1] += parseInt(leaf.follow_count);
                            arr[2] += parseInt(leaf.signed_count);
                            arr[3] += parseInt(leaf.add_count);
                        }
                    }
                }

                if (node['_child'] != null) {
                    for (var index in node['_child']) {
                        var child = node['_child'][index];
                        var re = addRow(child, wrapper, i + 1);
                        if (re != null) {
                            arr[0] += re[0];
                            arr[1] += re[1];
                            arr[2] += re[2];
                            arr[3] += re[3];
                        }
                    }
                }

                titletr.append($td.clone().text(arr[0]));
                titletr.append($td.clone().text(arr[1]));
                titletr.append($td.clone().text(arr[2]));
                titletr.append($td.clone().text(arr[3]));
                return arr;
            }
            return null;
        }
    </script>
    <include file="Home/Public/script"/>
</block>